﻿
function Sample11_Default() {

}

Sample11_Default.prototype.main = function() {

    this.AddHandler(this.btnToRight, "click", this.toRight);
    this.AddHandler(this.btnToLeft, "click", this.toLeft);
    
}

Sample11_Default.prototype.addOption = function(element, text, value)
{
    var option = document.createElement("OPTION");
    option.text = text;
    option.value = value;
    element.options.add(option);
}

Sample11_Default.prototype.toLeft = function() {

    for (var i = 0; i < this.ListBox2.options.length; i++) {

        if (this.ListBox2.options[i].selected) {
            this.addOption(this.ListBox1, this.ListBox2.options[i].text, this.ListBox2.options[i].value);
            this.ListBox2.options.remove(i);
        }

    }

}

Sample11_Default.prototype.toRight = function() {

    for (var i = 0; i < this.ListBox1.options.length; i++) {

        if (this.ListBox1.options[i].selected) {
            this.addOption(this.ListBox2, this.ListBox1.options[i].text, this.ListBox1.options[i].value);
            this.ListBox1.options.remove(i);
        }

    }

}
